#!/bin/bash
if [ -d wsserver/_build/default/lib/game/ebin ]; then
	rm -f wsserver/_build/default/lib/game/ebin/*
fi

rm -f wsserver/src/pb/*
\cp ../../data/erlang/* wsserver/src/pb/
\cp ../../data/erlang.common/* wsserver/include/

cd wsserver/

# 优先使用环境变量的 rebar3, 没有就使用项目自带的 rebar3
rebar3=$(which rebar3 2>/dev/null)
if [ ! -n "$rebar3" ]; then
	rebar3=./rebar3
fi

${rebar3} shell
